package ysf.com.simplediffculty;

/**
 * 第七题
 *
 * @author ysf
 * @date 2021/6/14 23:16
 */
public class SeventhDemos {


    public static void main(String[] args) {
       /* int x = 1534236469;
        int reverse = reverse(x);
        System.out.println(reverse);*/
        int z = 23;
        int m = z /= 10;
        System.out.println(m);
        /*int y = 1534236469;
        int reverses = reverses(y);
        System.out.println(reverses);
        System.out.println("最大值是 ====>"+Integer.MAX_VALUE+"最小值是======>"+Integer.MIN_VALUE);*/
    }

    /**
     * @param x
     * @return
     */
    /*public static int reverse(int x){
        int rev = 0;
        while (x != 0){
            int pop = x % 10;
            x /= 10;
            if (rev > Integer.MAX_VALUE/10) return 0;
            if (rev < Integer.MIN_VALUE/10) return 0;
            rev = rev * 10 + pop;
        }
        return rev;
    }*/
    public static int reverses(int x) {
        long rev = 0;
        while (x != 0) {
            // 取余数
            int pop = x % 10;
            //  x = x / 10; 取商
            x /= 10;
            rev = rev * 10 + pop;
        }
        if (rev > Integer.MAX_VALUE || rev < Integer.MIN_VALUE) {
            return 0;
        }
        return (int) rev;
    }


}
